package thread;

public class DaemonThreadDemo {
    public static void main(String[] args) {
        Thread liyang=new Thread("李洋"){
            public void run(){
                for (int i=0;i<5;i++){
                    System.out.println(getName()+"let me go!");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                    }
                }
            }
        };
        Thread liujie=new Thread("刘界"){
            public void run(){
             while (true){
                 System.out.println(getName()+"you jump i jump");
                 try {
                     Thread.sleep(1000);
                 } catch (InterruptedException e) {
                 }
             }
            }
        };
        liyang.start();
        liujie.setDaemon(true);
        liujie.start();//守护线程
        while (true);
    }
}
